package com.carleasoft.mps.adu.business.role.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.carleasoft.mps.adu.business.role.bean.entity.AuthorityRoleEntity;
import com.carleasoft.mps.adu.business.role.bean.po.AuthorityRoleInfoPagePo;
import com.carleasoft.mps.adu.business.role.bean.po.AuthorityRoleInfoPo;
import com.carleasoft.mps.adu.business.role.bean.vo.AuthorityRoleInfoPageVo;
import com.carleasoft.mps.adu.business.role.bean.vo.AuthorityRoleVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>Description: role dao</p>
 * @since 2020-04-30
 * @author ztm
 */
@Repository
public interface AuthorityRoleDao extends BaseMapper<AuthorityRoleEntity> {

    /**
     * 新增角色
     * @param authorityRoleEntity
     * @return int
     */
    int addRole(AuthorityRoleEntity authorityRoleEntity);

    /**
     * 编辑角色
     * @param authorityRoleEntity
     * @return int
     */
    int updateRole(AuthorityRoleEntity authorityRoleEntity);

    /**
     * 删除角色
     * @param roleCode
     * @return int
     */
    int deleteRole(@Param("roleCode") String roleCode);

    /**
     * 分页查询角色
     * @param page,authorityRoleInfoPagePo
     * @return List<AuthorityRoleInfoPageVo>
     */
    Page<AuthorityRoleInfoPageVo> pageQuery(Page<AuthorityRoleInfoPagePo> page, @Param("authorityRoleInfoPagePo") AuthorityRoleInfoPagePo authorityRoleInfoPagePo);

    /**
     * 角色详情查询
     * @param targetCode
     * @return AuthorityRoleVo
     */
    AuthorityRoleVo selectRoleByTargetCode(@Param("targetCode") String targetCode,@Param("targetType") Integer targetType);

    /**
     * 角色详情查询
     * @param roleCode
     * @return AuthorityRoleVo
     */
    AuthorityRoleVo selectRoleByRoleCode(@Param("roleCode") String roleCode);

    /**
     * 通过角色名称查重
     * @param authorityRoleInfoPo
     * @return int
     */
    int selectRoleCountByRoleName(@Param("authorityRoleInfoPo") AuthorityRoleInfoPo authorityRoleInfoPo);


}
